public class Multiple {
    public void multiple(int[][] a, int[][] b){
        int c[][]=new int[a.length][b[0].length];
        if(a[0].length!=b.length){
            System.out.print("矩阵不能相乘");
        }


        else{
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < b[0].length; j++) {
                    for (int k = 0; k < a[0].length; k++) {
                        c[i][j] += a[i][k] * b[k][j];
                    }
                }
            }
            System.out.println("相乘后矩阵为：");
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j <b[0].length; j++) {
                    System.out.print(c[i][j] + "  ");
                }
                System.out.println();
            }
        }

    }

}
